package com.zsc.wxapp.mapper;

import com.zsc.wxapp.entity.PowerGroup;
import com.zsc.wxapp.entity.dto.PowerGroupDTO;
import com.zsc.wxapp.entity.vo.ManagerVO;
import com.zsc.wxapp.entity.vo.RoleVO;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Set;

@Mapper
public interface PowerGroupMapper {

    public void addPowerGroup(@Param("powerGroupDTO") PowerGroupDTO powerGroupDTO,@Param("num") Integer num);

    @Select("select * from power_group")
    List<PowerGroup> getPowerGroup();

    void deletePowerGroup(List<Integer> ids);

    List<RoleVO> getRole(Integer roleId);

    @Update("update user set is_valid = #{isValid} where user_id = #{userId}")
    void updateUserStatus(Integer userId,Integer isValid);

    @Update("update user set is_valid = -1 where user_id = #{userId}")
    void deleteUser(Integer userId);

    @Select("select power_group_name from power_group where power_group_id = #{groupId}")
    String getGroupName(Integer groupId);

    @Select("select  count(*) from user where group_id = #{powerGroupId}")
    Integer getPowerGroupNum(Integer powerGroupId);

    @Select("select count(*) from power_group")
    Integer getNum();

    @Update("update user set group_id = #{powerGroupId} where user_id = #{userId}")
    void updateUserPowerGroup(Integer userId, Integer powerGroupId);

    @Select("select manager_name from customer_of_manager")
    Set<ManagerVO> getManager();
}
